{extend name="layout/layout"}
{block name="content"}
<main class="user_page  ">
    <section class="">
        <div class="layui-main">
            <div class="user_con">
                <div class="user_headpage" data-load="user_active_header">
                    {include file="user_activity/page_menu" menu='theme' id="$id" /}
                </div>
                <div class="right_main ">

                    <p class="ft24 mb10 ft-bold">活動主題</p>
                    <p class="ft14 gary_c9 mb20 ft-bold">選擇的主題越精準，感興趣的潛在消費者更容易看見你的活動</p>
                    <div class="block_com" style="min-height: 80vh;">
                        <div class="active_w1 active3 " style="margin:  0 auto;">
                            <from class="layui-form">
                                <p class="tac ft18 ft-bold mb30">選擇活動主題（最多選擇2個）</p>
                                <div class="active4_b1">
                                    <ul class="layui-row layui-col-space20 ul_height a4_ul1 active_ul more activity-theme">
                                        {foreach $themeList as $theme}
                                        <li class="layui-col-md2 layui-col-xs3">
                                            <div class="item {if in_array($theme.id,$themes)}active{/if}" data-id="{$theme.id}">
                                                <div class="img_box">
                                                    <img class="i1" src="__ROOT__/public/activity/images/a41.png">
                                                    <img class="i2" src="__ROOT__/public/activity/images/a42.png">
                                                </div>
                                                <p>{$theme.name}</p>
                                            </div>
                                        </li>
                                        {/foreach}
                                    </ul>
                                </div>
                                <div class="mt40 d-flex jc-s al-c">
                                    <button class="layui-btn layui-btn-lg w100 layui-bg-orange next-btn" onclick="save()">储存</button>
                                </div>
                            </from>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</main>
<script>
    function save() {
        var selected = [];
        $('.activity-theme .active').each(function (k,elem) {
            selected.push($(elem).data('id'))
        })
        $.quickPost('/activity/user/activity/{$id}/theme', {theme: selected});
    }
</script>
{/block}
